//
//  MeOneImageCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/7.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "MeOneImageCell.h"

@interface MeOneImageCell()
@property (weak, nonatomic) IBOutlet UIImageView *topImageView;
@property (weak, nonatomic) IBOutlet UILabel *bottomLabel;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelW;

@end

@implementation MeOneImageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.bottomLabel.font = MYFONT(13);
    
    self.countLabel.font = MYFONT(11);
    
    self.countLabel.layer.cornerRadius = 7;
    
    self.countLabel.layer.masksToBounds = YES;
    
    self.bottomLabel.textColor = darkGray;
    // Initialization code
}

- (void)setIndex:(NSIndexPath *)index{
    
    _index = index;
    
    self.countLabel.hidden = YES;
    
    if (index.item == 0) {
        self.topImageView.image = [UIImage imageNamed:@"mefive1"];
        self.bottomLabel.text = @"待付款";
        
        
        if (self.countModel.wait_pay.integerValue > 0) {
            
            self.countLabel.hidden = NO;
            self.countLabel.text = self.countModel.wait_pay;
            
            if (self.countModel.wait_pay.integerValue > 9) {
                self.labelW.constant = 20;
            } else {
                self.labelW.constant = 14;
                
            }

        }
        
    } else if (index.item == 1){
        
        self.topImageView.image = [UIImage imageNamed:@"mefive2"];
        
        self.bottomLabel.text = @"待发货";
        
        if (self.countModel.wait_delivery.integerValue > 0) {
            
            self.countLabel.hidden = NO;
            self.countLabel.text = self.countModel.wait_delivery;
            
            if (self.countModel.wait_delivery.integerValue > 9) {
                self.labelW.constant = 20;
            } else {
                self.labelW.constant = 14;
                
            }
            
        }

    }else if (index.item == 2){
        self.topImageView.image = [UIImage imageNamed:@"mefive3"];
        self.bottomLabel.text = @"已发货";
        
        if (self.countModel.wait_recieved.integerValue > 0) {
            
            self.countLabel.hidden = NO;
            
            self.countLabel.text = self.countModel.wait_recieved;
            
            if (self.countModel.wait_recieved.integerValue > 9) {
                self.labelW.constant = 20;
            } else {
                self.labelW.constant = 14;

            }
            
        }


    }else if (index.item == 3){
        self.topImageView.image = [UIImage imageNamed:@"mefive4"];
        self.bottomLabel.text = @"已收货";
        
        if (self.countModel.recieved.integerValue > 0) {
            
            self.countLabel.hidden = NO;
            self.countLabel.text = self.countModel.recieved;
            
            if (self.countModel.recieved.integerValue > 9) {
                self.labelW.constant = 20;
            } else {
                self.labelW.constant = 14;
                
            }
            
        }

    }else{
        
        self.topImageView.image = [UIImage imageNamed:@"mefive5"];
        self.bottomLabel.text = @"退货/售后";
        
        
        if (self.countModel.refundOrder.integerValue > 0) {
            
            self.countLabel.hidden = NO;
            self.countLabel.text = self.countModel.refundOrder;
            
            if (self.countModel.refundOrder.integerValue > 9) {
                self.labelW.constant = 20;
            } else {
                self.labelW.constant = 14;
                
            }
            
        }

        
    }
    
    
    
}


- (void)setCountModel:(MyAllOrderCount *)countModel{
    _countModel = countModel;
    
    
    
    
}

@end
